package com.example.designpattern.test.testInnerClass;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.TreeSet;


/**
 * @author 28116
 *
 * 
 */
public class Outer extends A {

    public static synchronized void t1() throws InterruptedException {
        System.out.println("t1()开始执行");
        Thread.sleep(1000);
        System.out.println("t1()等待");
        Outer.class.wait();
        System.out.println("t1()被唤醒");
        Thread.sleep(1000);
        System.out.println("t1()执行结束");
    }

    public static synchronized void t2() throws InterruptedException {
        System.out.println("t2开始执行");
        Thread.sleep(1000);
        System.out.println("唤醒t1()");
        Outer.class.notify();
        Thread.sleep(4000);
        System.out.println("t2执行完毕");
    }
    private int a;

    @Override
    public void a() {
        super.a();
    }

     class Inner extends B{
        int a;

        @Override
        public void a() {
            super.a();
        }

         class Inner2 {

        }
    }

    public static   void main(String[] args) throws InterruptedException {
        new Thread(()-> {
            try {
                t1();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
        Thread.sleep(5000);
        new Thread(()-> {
            try {
                t2();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
        Outer.Inner inner = new Outer().new Inner();
        Outer.Inner.Inner2 inner2 = new Outer().new Inner().new Inner2();
        System.out.println(Double.parseDouble("-5e2"));
        LinkedList<Integer> list=new LinkedList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        list.add(6);
        list.add(7);
        list.add(8);
        list.add(9);
        list.add(10);
        list.remove(2);
        list.remove(6);
        int j=0;
        for (Integer i : list) {
            j++;
        }
    }
    public int[] FindNumsAppearOnce (int[] array) {
        // write code here
        ArrayList<Integer> list=new ArrayList<>();
        for(int i=0;i<array.length;i++){
            if(i==0){
                list.add(array[0]);
            }else{
                if(!list.contains(array[i])){
                    list.add(array[i]);
                }
            }
        }
        TreeSet<Integer> set = new TreeSet(list);
        int[] resultArr=new int[set.size()];
        int j=0;
        for(Integer i:set){
            resultArr[j]= i;
            j++;
        }
        return resultArr;
    }
}

class A {
    public void a(){
        System.out.println("a1");
    }
}
class B{
    public void a(){
        System.out.println("a2");
    }
}
class C{
    public static void main(String[] args) {
        Outer.Inner inner=new Outer().new Inner();
    }
}
